import request from 'axios'

const api_name = '/cart'

export default {

  /*
  获取购物车分页列表
  */
  getPageList(page, limit) {
    return request({
      url: `/adminCart/table/${page}/${limit}`,
      method: 'get',
    })
  },
  removeById(id) {
    return request({
      url: `/adminCart/removeById/${id}`,
      method: 'delete',
    })
  },
  //编辑
  getById(id) {
    return request({
      url: `/adminCart/get/${id}`,
      method: 'get'
    })
  },
  //更新
  updateById(cart) {
    return request({
      url: `/adminCart/updateById`,
      method: 'put',
      data: cart
    })
  },
  batchRemove(idList) {
    return request({
      url: `/adminCart/batchRemove`,
      method: `delete`,
      data: idList
    })
  },
  /*
  搜索
  */
  getListByKeyword(page, limit, keyword) {
    return request({
      url: `/adminCart/search/${page}/${limit}`,
      method: 'get',
      params: {keyword}
    })
  }
}